#box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 50px;
}
body {
    text-align: center;
}
#box>div {
    position: relative;
    cursor: pointer;
    -webkit-transition: width 2s;
    -moz-transition: width 2s;
    -o-transition: width 2s;
    transition: width 2s;
    height: 30px;
    background-color: red;
    color: #fff;
    margin: 5px;
    padding: 0 10px;
    text-align: center;
    line-height: 30px;
}